//package com.zdd.ehe.service.impl;
//
//import com.zdd.ehe.EheApplication;
//import com.zdd.ehe.service.KafkaService;
//import org.apache.kafka.clients.consumer.ConsumerRecord;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.kafka.annotation.KafkaListener;
//import org.springframework.kafka.core.KafkaTemplate;
//import org.springframework.stereotype.Service;
//
///**
// * @version 1.0.0
// * @title: KafkaServicePredictImpl
// * @author: HFLy
// * @description:
// * @date: 7/3/2023 下午4:36
// */
//@Service
//public class KafkaServiceImpl implements KafkaService {
//    @Autowired
//    private KafkaTemplate<String, String> kafkaTemplate;
//
//
//    @Override
//    public void sendToPredict(String message) {
//        kafkaTemplate.send("predict",message);
//    }
//
//    @Override
//    @KafkaListener(topics = {"predict_result"},groupId = "predict_result_group")
//    public void acceptFromPredictResult(ConsumerRecord<String, String> consumer) {
//        System.out.println("从 predict 接收到消息");
//        EheApplication.PREDICT_RESULT=consumer.value();
//        EheApplication.FINISH_PREDICT=true;
//    }
//
//    @Override
//    public void sendToQuestion(String message) {
//        //用于智能问答
//        kafkaTemplate.send("question",message);
//        //用于词云显示最热10条
//        kafkaTemplate.send("question_count",message);
//    }
//
//    @Override
//    @KafkaListener(topics = {"answer"},groupId = "answer_group")
//    public void acceptFromAnswer(ConsumerRecord<String, String> consumer) {
//        System.out.println("从 answer 接收到消息");
//        EheApplication.ANSWER=consumer.value();
//        EheApplication.FINISH_QUESTION=true;
//    }
//
//    @Override
//    public void sendToPrice(String message) {
//        kafkaTemplate.send("price",message);
//    }
//
//    @Override
//    @KafkaListener(topics = {"price_predict"},groupId = "price_predict_group")
//    public void acceptFromPricePredict(ConsumerRecord<String, String> consumer) {
//        System.out.println("从 price_predict 接收消息");
//        EheApplication.PRICE_RESULT = consumer.value();
//        EheApplication.FINISH_PRICE = true;
//    }
//
//
//}
